package mta.patch;

import mta.localization.ModulePhrase;

import java.util.HashMap;

/**
 * Magento Translation Assistant
 * Copyright (c) 2009 Dmitry Nikolaev
 * Contact author: blackliteon@gmail.com
 */
public class PatchAll implements ModulePhrasePatchIF {

    private HashMap<String, String> patch;

    public PatchAll(HashMap<String, String> patch) {
        this.patch = patch;
    }

    public String getTranslation(ModulePhrase mPhrase) {

        String original = mPhrase.getPhrase();
        if (patch.containsKey(original)) {
            String translation = patch.get(original);
            if (!translation.isEmpty()) {
                return translation;
            }
        }
        return null;
    }
}
